"""taobao URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from chat.views import chat_with_ai, chat_page
from home.views import (index, detail,register,send_verification_code,
                        login,logout,user_center,
                        submit_article,test,test2,test3, search,search_suggest,comments)
from search.views import gen_inverted_index
from taobao import settings

urlpatterns = [

    # 路由 就是配置 请求与处理函数的对应关系
    # 处理函数，我们称之为视图函数，这些函数定义在 views.py这个文件里面
    path('admin/', admin.site.urls),
    path("", index),
    #path("detail", detail),
    path("detail/<int:a_id>", detail),
    path('wangeditor/', include('wangeditor.urls')),
    path("register/", register),
    path("send_verification_code", send_verification_code),
    path("login/", login),
    path("logout/", logout),
    path("user_center/", user_center),
    path("submit_article/", submit_article),
    path("test/", test),
    path("test2/", test2),
    path("test3/", test3),
    path("search/", search),
    path("gen_inverted_index/", gen_inverted_index),
    path("index/search_suggest/", search_suggest),
    path("comments/", comments),
    path("chat/", chat_with_ai),
    path('chat_page/',chat_page),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
